#!/usr/bin/env python3
from __future__ import annotations

import argparse
import re
import sys


def prefix_key(line):
    match = re.match(r"\*\s+([^:]+).*?pull/(\d+)", line)
    return match[1], int(match[2])


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "file", type=argparse.FileType("r"), default=sys.stdin, nargs="?"
    )
    args = parser.parse_args()

    print("".join(sorted(args.file.readlines(), key=prefix_key)))
